﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuantitativeInvestment.Bean;
namespace QuantitativeInvestment.Factor
{
    class SectorFactor:Factor
    {
        //股票列表对应
        public Dictionary<int, string> sectorList;
        public SectorFactor()
        {
            this.name = "行业";
            Parameter p = new Parameter("分类", "申万行业");
            p.type = "enum";
            p.enumList.Add("申万行业");
            p.enumList.Add("Wind行业");
            this.paraList.Add(p.name, p);

            p = new Parameter("等级",  "1");
            p.type = "enum";
            p.enumList.Add("1");
            p.enumList.Add("2");
            p.enumList.Add("3");
            p.enumList.Add("4");

            this.paraList.Add(p.name, p);

    
        }

        public override void addFactorValue(Stock stock)
        {
            string sectorType = this.paraList["分类"].value.ToString();
            int sectorLevel = Int32.Parse(this.paraList["等级"].value.ToString());
            this.sectorList = this.dataModel.getSectorList(sectorType, sectorLevel);

            if (!stock.factors.ContainsKey(this.name+sectorType+sectorLevel))
            {
                stock.factors.Add(this.name + sectorType + sectorLevel, this.dataModel.getStockSectorCodeList(sectorType, sectorLevel, stock.code));
            }
        }
    }
}
